﻿using System;
using System.Collections.Generic;
using System.Data.Objects;
using System.Linq;
using System.Web;
using TalentDesk.Contracts.Ef;
using TalentDesk.Data;

namespace TalentDesk.WcfService.EFQueries
{
    internal static class ProjectServiceEFQueries
    {
        public static readonly Func<TalentDeskEntities, IQueryable<Project>> ProjectsByIsInclude_CQ =
            CompiledQuery.Compile<TalentDeskEntities, IQueryable<Project>>(
            (ctx) => from p in ctx.Projects.Include("Expenses").Include("ProjectTeams").Include("Attachments")
                     select p);
        public static readonly Func<TalentDeskEntities, IQueryable<Project>> Projects_CQ =
           CompiledQuery.Compile<TalentDeskEntities, IQueryable<Project>>(
           (ctx) => from p in ctx.Projects
                    select p);
        public static readonly Func<TalentDeskEntities, int, IQueryable<Project>> ProjectsByIsIncludeAndProjectId_CQ =
           CompiledQuery.Compile<TalentDeskEntities, int, IQueryable<Project>>(
           (ctx, projectId) => from p in ctx.Projects.Include("Expenses").Include("ProjectTeams").Include("Attachments")
                               where p.ProjectId == projectId
                               select p);
        public static readonly Func<TalentDeskEntities, int, IQueryable<Project>> ProjectsByProjectId_CQ =
           CompiledQuery.Compile<TalentDeskEntities, int, IQueryable<Project>>(
           (ctx, projectId) => from p in ctx.Projects
                               where p.ProjectId == projectId
                               select p);



    }
}